home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / disktime.zip / ASK.PAS next >
Pascal/Delphi Source File  |  1985-11-02  |  2KB  |  58 lines

  1. Procedure Ask(Var Drive:Integer);
  2. {
  3.     This procedure determines which hard disk drive the user wants to test
  4.  
  5.     Input        None
  6.  
  7.     Output       Drive    Integer specifying drive to test
  8.  
  9.     Strategy     (1)      Determine how many hard drives controller reports
  10.                           Fatal error if no controller or no drives
  11.  
  12.                  (2)      If more than one drive, request drive from user
  13.  
  14. }
  15. Type
  16.     Result=Record
  17.                  Ax,Bx,Cx,Dx,Bp,Si,Di,Ds,Es,Flags:Integer;
  18.     End;
  19. Var
  20.    Found:Integer;
  21.    Sys:Result;
  22. Begin
  23.      SYS.AX:=$8*$0100+$01 { AH=8 means get parameters, AL=sector };
  24.      SYS.CX:=$0*$0100+$01 { CH=Cylinder, CL=Sector };
  25.      SYS.DX:=$0*$0100+$80 { DH=head, DL=$80+Drive };
  26.      Intr($13,Sys);
  27.  
  28.      NormVideo;
  29.  
  30.      If Odd(Sys.Flags) then
  31.         Begin
  32.              Writeln('You do not have a hard disk controller');
  33.              Halt;
  34.         End;
  35.      Found:=Lo(SYS.DX);
  36.  
  37.      Case Found of
  38.           0:Begin
  39.                    Writeln('No hard disk is attached to your controller');
  40.                    Halt;
  41.               End;
  42.           1:Drive:=0;
  43.           Else Begin
  44.               Drive:=0;
  45.                    While (Drive > Found) or (Drive < 1) do
  46.                          Begin
  47.                               Write('Found ',Found,' disks. ');
  48.                               Write('Which one do you want? ');
  49.                               Readln(Drive);
  50.                               Writeln;
  51.                          End;
  52.               Drive:=Drive-1;
  53.               End;
  54.           End;
  55.  
  56. End;
  57.  
  58.